#include "graph.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 2e2 + 5, inf = 0x3f3f3f3f3f3f3f3f;
ll n, mp[N], col[N], vis[N], dis[N][N];
void dfs(ll u)
{
    vis[col[u]] = 1;
    Move(1, col[u]);
    int COLOR = Color();
    Move(LastRoad(), Color());
    ll _NumberOfRoads = NumberOfRoads();
    for (ll i = 1; i <= _NumberOfRoads; ++i)
    {
        ll v = -1;
        auto check = [&]()
        {
            Move(i, col[u]);
            if (!vis[Color()])
                return 1;
            v = Color() - 1;
            Move(LastRoad(), Color());
            return 0;
        };
        if (check())
        {
            ll _LastRoad = LastRoad();
            v = ++n;
            col[v] = v + 1;
            dis[u][v] = dis[v][u] = 1;
            dfs(v);
            Move(_LastRoad, col[v]);
        }
        else
            dis[u][v] = dis[v][u] = 1;
    }
}
void Inspect(int R)
{
    memset(dis, 0x3f, sizeof dis);
    col[n = 1] = 2;
    dfs(1);
    for (ll i = 1; i <= n; ++i)
        dis[i][i] = 0;
    for (ll k = 1; k <= n; ++k)
        for (ll i = 1; i <= n; ++i)
            for (ll j = 1; j <= n; ++j)
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
    for (ll i = 1; i <= n; ++i)
        for (ll j = i + 1; j <= n; ++j)
            ++mp[dis[i][j]];
    for (ll i = 1; i <= R; ++i)
        Answer(i, mp[i]);
}
